﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Micrhard.FMCG.Server.Interface;
using Microsoft.Practices.Unity;
using Micrhard.FMCG.Server.Models;
using Microhard.Permission.Interface;
using Microhard.Permission.MVCFilter;
using Microhard.WebUI.Models;
using Microhard.Core;
using Telerik.Web.Mvc;
using Microhard.Core.DBUtility;

namespace Microhard.FMCG.WebUI.Areas.Inspection.Controllers
{
    public class IspTemplateController :   MicroHardBaseController<IspTemplateModel>
    {
        private IIspTemplate _resp = null;
        [Dependency]
        public IIspTemplate Category
        {
            set
            {
                base._repository = value;
                _resp = value;
            }
            get
            {
                return _resp;
            }
        }

        [MVCFilterAtrForLogon()]
        public ActionResult GetIspTemplateList(AttriubteOfSelectList ctrAttr)
        {
            IIspTemplate temp = IoC.Resolve<IIspTemplate>();
            var comp = temp.GetAllTemplate();
            ctrAttr.Data = comp.Select(r => new SelectData
            {
                ID = r.CheckListTemplateID.ToString(),
                Name = r.TemplateName
            }).ToList();
            return View("SelectList", ctrAttr);
        }
    }
}
